package com.linwen.excise.niuke._60;

import java.util.Scanner;

/**
 * @author wlw
 * @date 2023/3/17 11:45 PM
 */
public class _55挑7 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.println(function(n));
    }

    private static int function(int n) {
        if(n<7){
            return 0;
        }
        int result = 0;
        for (int i = 7; i <= n; i++) {
            if(rel7(i)){
                result++;
            }
        }
        return result;
    }

    private static boolean rel7(int i) {
        if(i%7==0||(String.valueOf(i).contains("7"))){
            return true;
        }
        return false;
    }
}
